% TEST_ID: LANG-EXPAND-0112
% CATEGORY: language/string
% 测试 string 的类型判断

function test_string_join()
x = {'hello', 'world'; 'HELLO', 'WORLD'};
y = join(x);
assert(strcmp(y{1}, {'hello world'}));
assert(strcmp(y{2}, {'HELLO WORLD'}));

x = {'1', '2' '3'; '2', '4' '6'};
y = join(x, {'+' '='});
assert(strcmp(y{1}, {'1+2=3'}));
assert(strcmp(y{2}, {'2+4=6'}));

y = join(x, {'+'; '-'});
assert(strcmp(y{1}, {'1+2+3'}));
assert(strcmp(y{2}, {'2-4-6'}));

x = {'abc' 'def'; 'ghi' 'jkl'};
y = join(x, '-', 1);
assert(strcmp(y{1}, {'abc-ghi'}));
assert(strcmp(y{2}, {'def-jkl'}));

y = join(x, '-', 3);
assert(strcmp(y{1}, {'abc'}));
assert(strcmp(y{2}, {'ghi'}));
assert(strcmp(y{3}, {'def'}));
assert(strcmp(y{4}, {'jkl'}));

x = {'abc', 'def'};
y = join(x, '');
assert(strcmp(y{1}, {'abcdef'}));

val = false;
try
    str = {'','y','z';
        'a','b','c'};
    newStr = join(str,1.5);
catch
    val = true;
end
assert(val);

assert(isequal(join("13333",1), "13333"));
assert(isequal(join("aaa",int32(1)), "aaa"));